package com.valveinspectionsys.settingsys.db;

import java.util.HashMap;
import java.util.Map;

import com.valveinspectionsys.dbhelp.XmlNameHelper;
import com.valveinspectionsys.util.SharedPreferenceUtil;


import android.content.Context;


/**
 * 基础设置
 * @author king
 *
 */
public class SettingDao {
     
	public SharedPreferenceUtil sp;
	
	public SettingDao(Context context){
		sp=new SharedPreferenceUtil(context);
	}
	
	/**
	 * 添加Web设置信息
	 * @param ip
	 * @param fileName
	 * @param name
	 * @param port
	 * @return
	 */
	public boolean saveWebSetting(String ip,String fileName,String name,String port){
		boolean b=false;
		    Map<String, String> map=new HashMap<String, String>();
		    map.put(XmlNameHelper.IP, ip);
		    map.put(XmlNameHelper.downloadFileName, fileName);
		    map.put(XmlNameHelper.port, port);
		    map.put(XmlNameHelper.webName, name);
		   b= sp.insertValue(map);
		return b;
		
	}
	
	/**
	 * 查询Web项目信息
	 * @return
	 */
	public String[] queryWebSeting(){
		String s[]=new String[4];
		s[0]=sp.getValue(XmlNameHelper.IP);
		s[1]=sp.getValue(XmlNameHelper.port);
		s[2]=sp.getValue(XmlNameHelper.webName);
		s[3]=sp.getValue(XmlNameHelper.downloadFileName);
		return s;
	}
	
	
	
}
